package fun.ipconfig.utils;

/**
 *  Description: 内部接口实现，封装同类型,实现泛型操作聚合
 * @author: gtinlian
 * @date: 2023/12/18
 */
public class InnerInterface {
    String name;
    String value;
    String name1;
    String value1;
    
    public interface Operation {
        Operation setName(String name);
        Operation setValue(String value);
        String getValue();
    }
    
    public interface Operation1 {
        Operation1 setName(String name);
        Operation1 setValue(String value);
        String getValue();
    }
    
    Operation1 getInstance1(){
        return new Operation1() {
            
            @Override
            public Operation1 setName(String name) {
                name1 = name;
                return this;
            }
            @Override
            public Operation1 setValue(String value) {
                value1 = value;
                return this;
            }

            @Override
            public String getValue() {
                return name + value;
            }
        };
    }
    Operation getInstance(){
        return new Operation() {
            
            @Override
            public Operation setName(String name) {
                InnerInterface.this.name = name;
                return this;
            }
            @Override
            public Operation setValue(String value) {
                InnerInterface.this.value = value;
                return this;
            }

            @Override
            public String getValue() {
                return name1 + value1;
            }
        };
    }
}
